/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Facade;

import Entity.Esterni;
import Entity.Utente;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Vito
 */
@Stateless
public class EsterniFacade extends AbstractFacade<Esterni> implements EsterniFacadeLocal {
    @PersistenceContext(unitName = "EnterpriseApplication1-ejbPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public EsterniFacade() {
        super(Esterni.class);
    }

    @Override
    public Esterni findByIdInt(Utente u){
        Esterni e=null;
        try{
            e = (Esterni) em.createNamedQuery("Esterni.findByIdInt").setParameter("idInt", u).getSingleResult();
        }catch(Exception ex){e=null;}
        return e;
    }
}
